package com.qfedu.meidijiaju.service.impl;

import com.qfedu.meidijiaju.common.ResponseData;
import com.qfedu.meidijiaju.entity.PinleiYxy;
import com.qfedu.meidijiaju.mapper.PinleiYxyMapper;
import com.qfedu.meidijiaju.service.PinleiYxyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 品类 服务实现类
 * </p>
 *
 * @author meidimeiju
 * @since 2022-10-03
 */
@Service
public class PinleiYxyServiceImpl extends ServiceImpl<PinleiYxyMapper, PinleiYxy> implements PinleiYxyService {

    @Autowired
    private PinleiYxyMapper pinleiYxyMapper;

    @Override
    public ResponseData<List<PinleiYxy>> allPinLei() {

        ResponseData<List<PinleiYxy>> responseData = new ResponseData<>();

        List<PinleiYxy> pinleiYxyList = pinleiYxyMapper.allPinLei();

        if (pinleiYxyList != null && pinleiYxyList.size() > 0){

            responseData.setCode(200);

            responseData.setData(pinleiYxyList);
        } else {

            responseData.setCode(400);

            responseData.setMsg("无数据！");
        }
        return responseData;
    }
}
